home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 January / Disc 3 / Amethyst.iso / live / usr / bin / unicode_start < prev    next >
Encoding:
Text File  |  2001-04-21  |  1.4 KB  |  52 lines

  1. #!/bin/sh
  2. # Enables Unicode processing in the current console.
  3. #
  4. # 1. The input side: the keyboard driver.
  5.  
  6. # Set the keyboard driver in Unicode mode. (Default is ASCII mode.)
  7. # This really does nothing with the way normal keys are handled in
  8. # the kernel. All it does is:
  9. # - It is necessary for `dumpkeys' in order to not drop U+XXXX
  10. #   entries from the keymaps.
  11. # - It is necessary for `loadkeys' in order to avoid warnings.
  12. # - Unicode characters typed as Alt-x1 ... Alt-xn (where x1,...,xn
  13. #   are digits on the numeric keypad) will be emitted in UTF-8.
  14.  
  15. kbd_mode -u
  16.  
  17. # Change the keyboard mapping in such a way that the non-ASCII keys
  18. # produce UTF-8 encoded multibyte sequences, instead of single bytes
  19. # >= 0x80 in a legacy 8-bit encoding.
  20.  
  21. dumpkeys | loadkeys --unicode
  22.  
  23. # 2. The output side: the console screen.
  24.  
  25. # Tell the console output driver that the bytes arriving are UTF-8
  26. # encoded multibyte sequences.
  27.  
  28. echo -n -e '\033%G'
  29.  
  30. # Tell the graphics card how to display Unicode characters not
  31. # contained in the IBM 437 character set (on PCs). The font should
  32. # have a Unicode map attached, or explicitly specified, e.g.,
  33. # by giving `def.uni' as a second argument.
  34.  
  35. DEFAULT_UNICODE_FONT=LatArCyrHeb-16
  36. # Also drdos8x16 is a good candidate.
  37.  
  38. case $# in
  39.     2)
  40.         setfont $1 -u $2
  41.         ;;
  42.     1)
  43.         setfont $1
  44.         ;;
  45.     0)
  46.         setfont $DEFAULT_UNICODE_FONT
  47.         ;;
  48.     *)
  49.         echo "usage: unicode_start [font [unicode map]]"
  50.         ;;
  51. esac
  52.